package dk.seqSite.utils {
	import flash.utils.describeType;

	public class DescribeTypeClasseWrap
	{
		
		//data
		private var _xmlType:XML;
		
		
		public function DescribeTypeClasseWrap(cClass:Class) {
			
			this.xmlType=describeType(cClass);
		}
		
		
		//class
		public function get sClass():String {
			var aType:Array=xmlType.factory.@type.split("::");
			return aType[1];
		}
		
		//package
		public function get sPackage():String {
			var aType:Array=xmlType.factory.@type.split("::");
			return aType[0];
		}
		
		// variables array
		public function get xmlListVariables():XMLList {
			return xmlType.variable;
		}				public function get xmlType() : XML {
			return _xmlType;		}
		
		public function set xmlType(xmlType : XML) : void {
			_xmlType = xmlType;
		}				public function get_bTypeIs(cType : Class) : Boolean {
			
			var oSecondaryClassWrap : DescribeTypeClasseWrap=new DescribeTypeClasseWrap(cType);
			
			if (sClass == oSecondaryClassWrap.sClass) {
				return true;
			}
			
			for each (var xmlExtendClass : XML in _xmlType.factory.extendsClass) {
				var sClass : String = xmlExtendClass.@type.toString().split("::")[1];
				if (sClass) {
					if (sClass==oSecondaryClassWrap.sClass) {
						return true;
					}
				}
			}

			for each (var xmlImplementsInterface : XML in _xmlType.factory.implementsInterface) {
				var sInterface : String = xmlImplementsInterface.@type.toString().split("::")[1];
				if (sInterface) {
					if (sInterface==oSecondaryClassWrap.sClass) {
						return true;
					}
				}
			}
			return false;		}
	}
}